<script type="text/javascript" src="<?php echo bu('/ckeditor/ckeditor.js'); ?>"></script>
<script type="text/javascript" src="<?php echo bu('/ckeditor/adapters/jquery.js'); ?>"></script>

<script>
  $(function()
  {
    var config = {
      skin:'kama',
      height:300,
      linkShowAdvancedTab: false,
       toolbar_Full: [
                            ['Styles','Format','Font','FontSize'],
                            ['Bold','Italic','Underline','StrikeThrough','-','Undo','Redo','-','Cut','Copy','Paste','Find','Replace','-','Outdent','Indent','-','Print'],
                            ['NumberedList','BulletedList','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
                            ['Image','Table','-','Link', 'TextColor','BGColor','Source'],
                          ],
    };

    $('.ckeditor').ckeditor(config);
  });
</script>

<div class="main-content">
	<header>
		<a href="<?php echo bu('admin/news/new'); ?>" class="fr button button-gray">Add News</a>
		<h2>Add News</h2>
	</header>

	<section>
    <?php
      $form = $this->beginWidget('CActiveForm', array(
        'id' => 'form',
        'action' => bu('admin/news/create'),
        'htmlOptions' => array(
          'class' => 'form',
          'novalidate' => 'true',
          'enctype' => 'multipart/form-data',
        ),
      ));
    ?>
			<fieldset>
				<legend>Please insert your news content</legend>
				<label>Subject <em>*</em></label>
				<input type="text" name="News[subject]" required="required" />

				<label>For <em>*</em></label>
				<select name="News[member_id]" required="required">
          <option value="0">All Members</option>
					<?php foreach($members as $member){ ?>
					<option value="<?php echo $member->id; ?>"><?php echo $member->name; ?></option>
					<?php } ?>
				</select>

				<label>Content <em>*</em></label>
				<div style="border:1px solid #FFF; float:left;">
          <?php echo $form->textArea($news, 'content', array('required' => 'required', 'style' => 'width:400px; height:300px', 'class' => 'ckeditor')); ?>
        </div>

				<div class="action" style="position:relative; top:10px;">
						<button class="button button-gray" type="submit"><span class="accept"></span>OK</button>
						<button class="button button-gray" type="reset">Reset</button>
				</div>
			</fieldset>
    <?php $this->endWidget(); ?>
	</section>
</div>